package com.gs.process.demo.config;

import com.gs.process.core.interceptor.ProcessInterceptor;
import com.gs.process.core.user.ProcessUser;
import com.gs.process.core.user.ProcessUserService;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Collections;

/**
 * @author Shuai Guo
 * @version 1.0
 * @description
 * @date 2021/7/29
 */
@Component
public class ProcessUserInterceptor implements ProcessInterceptor {

    @Resource
    private ProcessUserService processUserService;

    @Override
    public void beforeExecuteProcessor(HttpServletRequest httpServletRequest) {
        ProcessUser processUser = new ProcessUser();
        processUser.setUserId(4L);
        processUser.setUserRealName("gs");
        processUser.setUsername("gs");
        processUser.setUserRoles(Collections.singletonList(4L));
        processUser.setUserDept(1L);
        processUserService.set(processUser);
    }
}
